﻿using System;
namespace Xtee.XteeClient.Colors {
    using global::Colors.Xroad.Eu;
    using global::Colors.Xroad.Eu.Messages;
    using global::Xtee.Core;
    using System.Collections.Generic;
    
    
    public class ColorsAdapter {
        
        private string _protocolVersion = "4.0";
        
        private Xtee.Core.Client.IXteeCommand _xteeCommand;
        
        public ColorsAdapter() : 
                this(new Xtee.Core.Client.XteeCommand(new Xtee.Core.Client.Config.Configuration())) {
        }
        
        public ColorsAdapter(Xtee.Core.Client.IXteeCommand command) {
            this._xteeCommand = command;
        }
        
        public virtual Xroad.Eu.Xsd.Identifiers.XRoadServiceIdentifierType Service {
            get {
                return new Xroad.Eu.Xsd.Identifiers.XRoadServiceIdentifierType(){ObjectType = "SERVICE", XRoadInstance = "EE",MemberClass = "GOV", MemberCode = "700030", SubsystemCode = "Colors"};
            }
        }
        
        public virtual string ProtocolVersion {
            get {
                return this._protocolVersion;
            }
            set {
                this._protocolVersion = value;
            }
        }
        
        public virtual Xtee.Core.Client.IXteeCommand XteeCommand {
            get {
                return this._xteeCommand;
            }
            set {
                this._xteeCommand = value;
            }
        }
        
        public virtual global::Colors.Xroad.Eu.Messages.SettingsResponse ConfigureAlphaComponent(short request, System.Collections.Generic.List<global::Colors.Xroad.Eu.UserRole> userRoles) {
            var configureAlphaComponentInputHeader = new global::Colors.Xroad.Eu.Headers.ConfigureAlphaComponentInputHeader();
            configureAlphaComponentInputHeader.Client = _xteeCommand.Configuration.Client;
            configureAlphaComponentInputHeader.Id = Xtee.Core.Utils.StringUtils.GenerateNonce();
            configureAlphaComponentInputHeader.ProtocolVersion = this.ProtocolVersion;
            configureAlphaComponentInputHeader.Service = Service;
            configureAlphaComponentInputHeader.Service.ServiceCode = "ConfigureAlphaComponent";
            configureAlphaComponentInputHeader.Service.ServiceVersion = "v1";
            configureAlphaComponentInputHeader.UserId = _xteeCommand.Configuration.UserId;
            configureAlphaComponentInputHeader.Issue = _xteeCommand.Configuration.Issue;
            configureAlphaComponentInputHeader.UserRoles = userRoles;
            global::Xtee.Core.Envelope.ISoapEnvelope responseEnvelope = _xteeCommand.Execute(new global::Xtee.Core.Envelope.SoapEnvelope(new System.Xml.XmlQualifiedName("tns", "http://colors.x-road.eu/"), new System.Collections.Generic.List<System.Xml.XmlQualifiedName>{}, "ConfigureAlphaComponent", configureAlphaComponentInputHeader, new global::Colors.Xroad.Eu.Messages.ConfigureAlphaComponent(request)));
            return ((global::Colors.Xroad.Eu.Messages.SettingsResponse)(responseEnvelope.Body));
        }
        
        public virtual global::Colors.Xroad.Eu.Messages.CanMixResponse CanMix(global::Colors.Xroad.Eu.Color color) {
            var canMixInputHeader = new global::Colors.Xroad.Eu.Headers.CanMixInputHeader();
            canMixInputHeader.Client = _xteeCommand.Configuration.Client;
            canMixInputHeader.Id = Xtee.Core.Utils.StringUtils.GenerateNonce();
            canMixInputHeader.ProtocolVersion = this.ProtocolVersion;
            canMixInputHeader.Service = Service;
            canMixInputHeader.Service.ServiceCode = "CanMix";
            canMixInputHeader.Service.ServiceVersion = "v1";
            canMixInputHeader.UserId = _xteeCommand.Configuration.UserId;
            canMixInputHeader.Issue = _xteeCommand.Configuration.Issue;
            global::Xtee.Core.Envelope.ISoapEnvelope responseEnvelope = _xteeCommand.Execute(new global::Xtee.Core.Envelope.SoapEnvelope(new System.Xml.XmlQualifiedName("tns", "http://colors.x-road.eu/"), new System.Collections.Generic.List<System.Xml.XmlQualifiedName>{}, "CanMix", canMixInputHeader, new global::Colors.Xroad.Eu.Messages.CanMix(color)));
            return ((global::Colors.Xroad.Eu.Messages.CanMixResponse)(responseEnvelope.Body));
        }
        
        public virtual global::Colors.Xroad.Eu.Messages.MixSingleResponse MixSingle(global::Colors.Xroad.Eu.Mix mix) {
            var mixSingleInputHeader = new global::Colors.Xroad.Eu.Headers.MixSingleInputHeader();
            mixSingleInputHeader.Client = _xteeCommand.Configuration.Client;
            mixSingleInputHeader.Id = Xtee.Core.Utils.StringUtils.GenerateNonce();
            mixSingleInputHeader.ProtocolVersion = this.ProtocolVersion;
            mixSingleInputHeader.Service = Service;
            mixSingleInputHeader.Service.ServiceCode = "MixSingle";
            mixSingleInputHeader.Service.ServiceVersion = "v1";
            mixSingleInputHeader.UserId = _xteeCommand.Configuration.UserId;
            mixSingleInputHeader.Issue = _xteeCommand.Configuration.Issue;
            global::Xtee.Core.Envelope.ISoapEnvelope responseEnvelope = _xteeCommand.Execute(new global::Xtee.Core.Envelope.SoapEnvelope(new System.Xml.XmlQualifiedName("tns", "http://colors.x-road.eu/"), new System.Collections.Generic.List<System.Xml.XmlQualifiedName>{}, "MixSingle", mixSingleInputHeader, new global::Colors.Xroad.Eu.Messages.MixSingle(mix)));
            return ((global::Colors.Xroad.Eu.Messages.MixSingleResponse)(responseEnvelope.Body));
        }
        
        public virtual global::Colors.Xroad.Eu.Messages.MixManyResponse MixMany(System.Collections.Generic.List<global::Colors.Xroad.Eu.Color> colors) {
            var mixManyInputHeader = new global::Colors.Xroad.Eu.Headers.MixManyInputHeader();
            mixManyInputHeader.Client = _xteeCommand.Configuration.Client;
            mixManyInputHeader.Id = Xtee.Core.Utils.StringUtils.GenerateNonce();
            mixManyInputHeader.ProtocolVersion = this.ProtocolVersion;
            mixManyInputHeader.Service = Service;
            mixManyInputHeader.Service.ServiceCode = "MixMany";
            mixManyInputHeader.Service.ServiceVersion = "v1";
            mixManyInputHeader.UserId = _xteeCommand.Configuration.UserId;
            mixManyInputHeader.Issue = _xteeCommand.Configuration.Issue;
            global::Xtee.Core.Envelope.ISoapEnvelope responseEnvelope = _xteeCommand.Execute(new global::Xtee.Core.Envelope.SoapEnvelope(new System.Xml.XmlQualifiedName("tns", "http://colors.x-road.eu/"), new System.Collections.Generic.List<System.Xml.XmlQualifiedName>{}, "MixMany", mixManyInputHeader, new global::Colors.Xroad.Eu.Messages.MixMany(colors)));
            return ((global::Colors.Xroad.Eu.Messages.MixManyResponse)(responseEnvelope.Body));
        }
    }
}
